import {createRouter,createWebHistory,createWebHashHistory} from 'vue-router'
const Home = ()=>import('../views/Home')
const About = ()=>import('../views/About')
const User = ()=>import('../views/User')

const routes=[
  {
    path:'/',
    name:'Home',
    // component:Home
    // 使用多视图到同一个组件
    components: {
      default:Home,//缺省
      About,
      User
    }
  },
  {
    path: '/about',
    name: 'About',
    component: About
  },
  {
    path: '/user',
    name: 'User',
    component: User
  }
]

const router = createRouter({
  history:createWebHistory(process.env.BASE_URL),
  // history:createWebHashHistory(process.env.BASE_URL),
  routes
})
export default router